<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'web_site/web_page/web_page.class.php');
require_once($WSC->get_site_inc_dir().'modules/web_site_vanilla/vanilla_web_page_view.class.php');
require_once(TANGRA_MAIN_DIR.'exceptions/te_page_failed_to_init.class.php');


abstract class Vanilla_Web_Page extends Web_Page {

	function __construct($page_name) {
		parent::__construct($page_name);
	}


	public function init() {
		parent::init();

		// will be used in HTML header <base href="{$_base_url}" />
		$this->export('_base_url', $this->_config->get_base_url());

		// will be used to switch presentation for developers for testing/debuging purposes
		$this->export('_site_mode', $this->_config->get_site_mode());


		$this->export('_default_encoding', $this->_config->get_default_encoding());

		$this->export('_server_error_page', $this->_config->get_server_error_page());

		$this->export('_instance_name', $this->_config->get_instance_name());

	}


	public function create_view($name = 'default') {
		$ret = new Vanilla_Web_Page_View($this, $name);

		return $ret;
	}


	public function run() {
		$ret = $this->get_view('default');


		return $ret;
	}
}



